Skip to content

Skip buffered multipart line endings - #373

Merged
Kludex merged 1 commit into
mainfrom
skip-buffered-multipart-line-endings
Nov 16, 2026
Merged

Kludex merged 1 commit into
mainfrom
skip-buffered-multipart-line-endings

Conversation

@Kludex

@Kludex Kludex commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Evaluate the remaining multipart proposal from @deadstrobe5 in issue #365. Consume buffered CRLF sequences directly after header values, at the end of headers, and after between-part boundaries, instead of visiting each intermediate parser state. Split or invalid line endings keep the existing validation paths.

Add a public-API regression test that checks callback order and data across every two-chunk split and byte-by-byte writes, including empty header values and a headerless part. No workflow changes are included.

The earlier local evaluation improved form parsing but showed an approximately 5% slower 8 MB upload case. This PR uses the existing CodSpeed benchmarks to evaluate that tradeoff against current main; no across-the-board speedup is assumed.

Validation on Python 3.13.18:

  • scripts/check, scripts/test --strict-config --strict-markers (188 tests, 100% coverage), and scripts/rename pass.
  • Starlette's full suite at 0f08970e passes with the candidate installed: 1,419 passed, 2 expected failures, 100% line and branch coverage.
  • 30,000 differential multipart cases match callbacks, consumed bytes, and errors across chunking, malformed input, header limits, and body-size limits.

Session: pi --session 01a1e0a2-78a9-7473-86ce-b992bd92cf74

View guided diff

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T09:59:20.004325Z b8894d1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codspeed

codspeed Bot commented Nov 16, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 25.81%

1 warning

⚠️ 1 benchmark with a significant change ran on different hardware

Its base and head results were measured on machines with a different CPU, core count or memory, so the change might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

⚡ 1 improved benchmark
✅ 4 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ test_parse_multipart_large_form 6.6 ms 5.2 ms +25.81%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing skip-buffered-multipart-line-endings (b8894d1) with main (55ba6f4)

Open in CodSpeed

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

View guided diff | Re-trigger cubic

@Kludex
Kludex merged commit 8ee1f50 into main Nov 16, 2026
14 checks passed
@Kludex
Kludex deleted the skip-buffered-multipart-line-endings branch November 16, 2026 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant